 //导入自定义验证规则的包
 const Joi = require('joi')
 const joi = require('joi')

 //用户名的验证规则
 const username = joi.string().alphanum().min(3).max(10).required()
     //密码验证规则
 const password = joi.string().pattern(/^[\S]{6,12}$/).required()
     //登录表单的验证规则对象
 const email = joi.string().email({ minDomainSegments: 2, tlds: { allow: ['com', 'net'] } })
 const mobile = joi.string().pattern(/^1[3-9]\d{9}$/)
 exports.login_schema = {
     body: {
         username,
         password
     }
 }
 exports.user_create_schema = {
     body: {
         username,
         password,
         email,
         mobile

     }
 }
 exports.user_edit_schema = {
     body: {
         //es6中键和值一样可以省略一个
         email,
         mobile
     }
 }